import { Http } from "@/utils/request";
import { Toast } from "@/utils/toast";
import { delayTask } from "@/utils/timer";

const baseUrl = "/course";

export const mini_course_detail_api = (
  data: { id: string; batch_no?: string },
  showError = true
) => {
  return Http.get<{
    mini_detail: any;
    mini_trial_list?: any[];
    mini_course_list: any[];
  }>(`${baseUrl}/mini_course_detail`, data).catch((error: Error) => {
    showError && delayTask(60, () => Toast.show(error.message));
    return Promise.reject(error);
  });
};
